package cn.zyl.demo.jsp.config;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.http.HttpStatus;

/**
 * ConfigFactory类说明: 编码方式配置
 *
 * @author z.y.l
 * @version v1.0
 * @date 2020-09-01
 */
public class ConfigFactory {
    /** 等同于配置文件配置*/
    public ConfigurableServletWebServerFactory webServerFactory(){
        TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
        factory.setPort(9000);
        factory.setContextPath("/jsp");
        factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404.html"));
        return factory;
    }
}
